|
|
|
|
|
|
|
If youre calculating the percentage complete of a process, you need to set the Min property to 0 and the Max property to 100. You then need to know how many total operations youre doing and which operation youre currently on. Youll then calculate a percentage and set this number in the Value property of the progress bar. |
|
|
|
|
|
|
|
|
If youre looping through a set of records, you may want to find out how many records you have in the set; then you can set the Value property to the record number youre currently on. In either scenario, its up to you to set the Value property as well as the Min and Max properties appropriately. |
|
|
|
|
|
|
|
|
Lets look at the example for this chapter. When the user clicks the command button, the percentage complete displays as the code loops through a set of employee records. Nothing is done to the records, the code just loops through them. In fact, so that the progress bars wont move too fast, a Delay procedure is added that pauses for a few CPU cycles before moving to the next record in the set. Heres the code: |
|
|
|
 |
|
|
|
|
Private Sub cmdCount_Click()
Dim oRS As Recordset
Dim intCount As Integer
Dim intLoop As Integer
Dim intPercent As Integer
Dim strSQL As String
Screen.MousePointer = vbHourglass
' Retrieve Record Count
intCount = RecCountGet()
Set oRS = New Recordset
strSQL = "SELECT lEmp_id FROM tblEmployees"
oRS.Open strSQL, _
ConnectString(), _
adOpenForwardOnly
If Not oRS.EOF Then
pbrSmooth.Min = 0
pbrSmooth.Max = 100
pbrCount.Min = 0
pbrCount.Max = 100 |
|
|
|
|
|